package com.kaishengit.web;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.kaishengit.pojo.Inventory;
import com.kaishengit.service.InventoryService;
@Controller
public class InventoryController {
	private InventoryService inventoryService;
	
	@RequestMapping("/inventoryList")
	public String findAll(Model model){
		List<Inventory> inventoryList = inventoryService.findAll();
		model.addAttribute("inventoryList", inventoryList);
		return "inventoryList";
	}
	
	@RequestMapping("/addInventory")
	public String add(Inventory inventory){
		inventoryService.add(inventory);
		return "redirect:/inventoryList";
	}
	
	@Autowired
	public void setInventoryService(InventoryService inventoryService) {
		this.inventoryService = inventoryService;
	}
	

}
